<html>
<head><title>Keep Last Two Tabs Options</title>
<script type="text/javascript">

// Saves options to localStorage.
function save_options() {
  var select_new_created = document.getElementById("select_new_created");
  if (select_new_created.checked)
    localStorage["select_new_created"] = 1;
  else
    localStorage["select_new_created"] = 0;

  var close_second_tab = document.getElementById("close_second_tab");
  if (close_second_tab.checked)
    localStorage["close_second_tab"] = 1;
  else
    localStorage["close_second_tab"] = 0;

  // Update status to let user know options were saved.
  var status = document.getElementById("status");
  status.innerHTML = "Options Saved.";
  setTimeout(function() {
    status.innerHTML = "";
  }, 750);
}

// Restores select box state to saved value from localStorage.
function restore_options() {
  var select_new_created = localStorage["select_new_created"];
  if (select_new_created == 1) {
  	document.getElementById("select_new_created").checked = true;
  }
  var close_second_tab = localStorage["close_second_tab"];
  if (close_second_tab == 1) {
  	document.getElementById("close_second_tab").checked = true;
  }
}

</script>
</head>
<body onload="restore_options()">

<div>
Select new created tab? <input type="checkbox" id="select_new_created" name="select_new_created" value="true"/>
</div>

<div>
Close tabs if they are New Tab pages (chrome://newtab/) after opening a new tab? <input type=checkbox id="close_second_tab" name="close_second_tab" value="true"/>
</div>

<div>
<button onclick="save_options()">Save</button> <span id="status"></span>
</div>
</body>
</html>
<!-- vim: set sw=2 ts=2 et: -->
